﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using InmobiliariaNegocio;

namespace InmobiliariaIntefaz
{
    public partial class MDIInmobiliaria : Form
    {
        private Inmobiliaria inmobiliaria;

        public MDIInmobiliaria()
        {
            try
            {
                InitializeComponent();

                inmobiliaria = Inmobiliaria.CrearInmobiliaria();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void CascadeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.Cascade);
        }

        private void TileVerticalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileVertical);
        }

        private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LayoutMdi(MdiLayout.ArrangeIcons);
        }

        private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (Form childForm in MdiChildren)
            {
                childForm.Close();
            }
        }

        private void tsbInmobiliaria_Click(object sender, EventArgs e)
        {
            formInmueble();
        }

        private void tsbCliente_Click(object sender, EventArgs e)
        {
            formCliente();
        }

        private void formCliente()
        {
            frmCliente f = new frmCliente(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formInmueble()
        {
            frmInmueble f = new frmInmueble(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formReservar()
        {
            frmReservar f = new frmReservar(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formCalcular()
        {
            frmCalcular f = new frmCalcular(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formConcretar()
        {
            frmConcretar f = new frmConcretar(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formListarA()
        {
            frmListarA f = new frmListarA(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void formListarV()
        {
            frmListarV f = new frmListarV(inmobiliaria);
            f.MdiParent = this;
            f.Show();
        }

        private void MDIInmobiliaria_FormClosing(object sender, FormClosingEventArgs e)
        {
            inmobiliaria.guardar();
        }

        private void helpToolStripButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void tsbCalcular_Click(object sender, EventArgs e)
        {
            formCalcular();
        }

        private void tsbBarraCalcular_Click(object sender, EventArgs e)
        {
            formCalcular();
        }

        private void tsbBarraInmueble_Click(object sender, EventArgs e)
        {
            formInmueble();
        }

        private void tsbBarraCliente_Click(object sender, EventArgs e)
        {
            formCliente();
        }

        private void tsbReservar_Click(object sender, EventArgs e)
        {
            formReservar();
        }

        private void tsbConcretar_Click(object sender, EventArgs e)
        {
            formListarA();
        }

        private void toolStripMenuItem1_Click_1(object sender, EventArgs e)
        {
            formListarV();
        }

        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            formConcretar();
        }

        private void tsbBarraReservar_Click(object sender, EventArgs e)
        {
            formReservar();
        }

        private void tsbBarraConcretar_Click(object sender, EventArgs e)
        {
            formConcretar();
        }

        private void tsbBarraListarVentas_Click(object sender, EventArgs e)
        {
            formListarV();
        }

        private void tsbBarraAlquiler_Click(object sender, EventArgs e)
        {
            formListarA();
        }
    }
}
